//
//  MoyaExample.swift
//  SwiftCode
//
//  Created by yuhus on 2023/8/23.
//

import Foundation
import Moya

final class MoyaExample: ListViewController {
  override func getItemCount() -> Int {
    data.count
  }
  
  override func getItem(_ indexPath: IndexPath) -> Item {
    data[indexPath.row]
  }
  
  private lazy var data: [Item] = [
    .init(title: "Session.default", description: "请求百度", action: requests ),
  ]
}

private func requests() {
  let provider = MoyaProvider<MyService>()
  provider.request(.createUser(firstName: "James", lastName: "Potter")) { result in
    print(result)
  }
}
